Einhugur Word Plugin for Xojo

EinhugurWord.Document Class

Class that represents docx Word document.

This class can Create, Read, Write and Edit Word documents.

EinhugurWord.Container
   Document

class EinhugurWord.Document

Constructors

Document (private) Private constructor.

Properties

CreatedDateCreation date of the document. (Meta data)
CreatorCreator of the document. (Meta data)
DefaultSectionReturns default section for the document. (Default page setup for the document)
DescriptionDocument description. (Meta data)
DocumentDefaultsGets the document defaults object.
ItemCount (Inherited) Number of items in the container.
KeyWordsKeywords for the document. (Meta data)
LastModifiedByName of person to last modify the document. (Meta data)
ModifiedDateLast modification date of the document. (Meta data)
ParagraphCount (Inherited) Returns number of paragraphs in the container.
RevisionDocument revision. (Meta data)
SubjectDocument subject. (Meta data)
TableCount (Inherited) Returns number of tables in the container.
TitleDocument title. (Meta data)

Methods

AddNewCharacterStyleAdds new character style to the document.
AddNewParagraphStyleAdds new paragraph style to the document.
AddNewTabletyleAdds new table style to the document.
AppendPageBreakAppends page break at back of the document.
AppendParagraph (Inherited) Appends paragraph at back of the container, creating one run for the string passed in with this method.
AppendParagraph (Inherited) Appends paragraph at back of the container, creating one run for the image data passed in with this method. (This variation of the AppendParagraph is to embed images).
AppendSectionBreakAppends section break with a given rule.
AppendTable (Inherited) Appends table to the back of the container.
ApplyFieldDataApplies filed data document wide. This covers paragraphs, tables, nested tables, nested paragraphs.
CharacterStylesReturns array of all predefined CharacterStyles in the document.
shared CreateCreates new document at given location.
CreateListIndentCreates ListIndent object to be used with group of paragraphs.
FooterGets footer of requested type from the document, optionally creating new footer if footer with the requested type does not exist.
GetBookmarksGets all bookmarks in the document.
HeaderGets header of requested type from the document, optionally creating new header if header with the requested type does not exist.
Item (Inherited) Returns item at given index. (Paragraphs or tables)
Items (Inherited) Returns DocumentItemIterator for the items in the container. This property is for using with for each statements.
shared OpenOpens word document.
Paragraph (Inherited) Gets paragraph at given index.
ParagraphStylesReturns array of all predefined ParagraphStyles in the document.
Paragraphs (Inherited) Returns ParagraphIterator for the paragraphs in the container. This property is for using with for each statements.
RemoveBookmarkRemoves bookmark from the document.
RemoveItem (Inherited) Removes item from the container.
SaveSaves the document.
SaveAsSaves the document with new name and or path.
Table (Inherited) Gets table at given index.
TableStylesReturns array of all predefined TableStyles in the document.
Tables (Inherited) Returns TableIterator for the tables in the container. This property is for using with for each statements.

Examples

This example creates a simple hello world Word document:


using EinhugurWord

var ft as FileType = new FileType
ft.Extensions = "docx"
ft.Name = "Word Document"

var f as FolderItem = FolderItem.ShowSaveFileDialog(ft, "New document.docx")

if f <> nil then
    try
       var doc as Document = Document.Create(f)
      
       doc.Creator = "Einhugur test user"
       doc.LastModifiedBy = "Einhugur test user"
       doc.Subject = "My first"
      
       // Empty document has one paragraph so we just populate the first one instead of adding
       call doc.Paragraph(0).AppendRun("Hello world ! This is my first paragraph")
      
       var p as Paragraph = doc.AppendParagraph("My second paragraph.")
       p.Run(0).Bold = BooleanAttribute.YES
       var r as Run = p.AppendRun(" And we can do styles.")
       r.Italic = BooleanAttribute.YES
      
       call doc.AppendParagraph("Check next page to see table we created")
      
      
       // Lets add page break
       doc.AppendPageBreak()
      
       // And then finally paragraph with red text on the 2nd page
       p = doc.AppendParagraph("Our paragraph on the 2nd page")
       p.Run(0).TextColor = &c800000
      
      
       // Add some table
       var t as Table = doc.AppendTable(3,2)
       var row as TableRow = t.Row(0)
       call row.Cell(0).Paragraph(0).AppendRun("Data in table cell")
       call row.Cell(1).Paragraph(0).AppendRun("1")
       call row.Cell(2).Paragraph(0).AppendRun("2 !")
      
       doc.Save()
      
    catch e as WordException
    MessageBox e.Message
end try
end if

Supported Platforms:

  • macOS Intel 64 bit
  • macOS Apple Silicon
  • Windows 32 bit
  • Windows 64 bit
  • Windows ARM 64 bit
  • Linux 32 bit
  • Linux 64 bit
  • Linux ARM 32 bit
  • Linux ARM 64 bit
  • iOS